/*function ListNode(x){
    this.val = x;
    this.next = null;
}*/
function printListFromTailToHead(head)
{
    // write code here
    // 特殊输入判断
    if(head === null) return []
    // 定义一个cur指向head
    var cur = head
    var res = []
    while(cur){
      res.unshift(cur.val)
      cur = cur.next
    }
    return res
}
module.exports = {
    printListFromTailToHead : printListFromTailToHead
};